

CC = gcc
CFLAGS = -Wall -g -I.

ifeq ($(OS),Windows_NT)

ARCH = $(shell gcc -dumpmachine)
ifeq ($(ARCH), x86_64-w64-mingw32)
	ARCH = /x64
else
	ARCH =
endif

NPCAP_SDK = ../npcap-sdk-1.06
INC = -I$(NPCAP_SDK)/include
LIBS = -L$(NPCAP_SDK)/lib$(ARCH) -lws2_32 -lwpcap
EXE = .exe

else

INC +=
LIBS += -lpcap
EXE =

endif

TARGET = kcp2raw$(EXE)
SRC = main.c skproxy.c rawio.c ikcp.c kcp_tunnel.c
LIBS += -lpthread

all: $(TARGET)

$(TARGET):$(SRC)
	$(CC) $(CFLAGS) $(INC) -o $@ $^ $(LIBS)

$(SRC): main.h

clean:
	rm -f $(TARGET) *.o


